import request from '@/utils/request'

export const reqLogin = obj => {
  return request({
    method: 'post',
    url: '/sys/login',
    data: obj
  })
}

export const reqGetUserInfo = () => {
  return request({
    method: 'post',
    url: '/sys/profile'
  })
}

export const reqGetUserDetailById = (id) => {
  return request({
    method: 'get',
    url: `/sys/user/${id}`
  })
}

export const reqSaveUserDetailById = (data) => {
  return request({
    method: 'put',
    url: '/sys/user/' + data.id,
    data
  })
}

/** *
 *  读取用户详情的基础信息 (个人详情-下面的接口)
 * **/
export function reqGetPersonalDetail(id) {
  return request({
    method: 'get',
    url: `/employees/${id}/personalInfo`
  })
}

/** *
 *  更新用户详情的基础信息 (个人详情-下面的接口)
 * **/
export function reqUpdatePersonal(data) {
  return request({
    method: 'put',
    url: `/employees/${data.userId}/personalInfo`,
    data
  })
}
